<?php
require_once "xheditor.php";
header('Content-Type: text/html; charset=UTF-8');

$xheditor_obj = new xheditor();

$action = $_GET['h'] ? $_GET['h'] : 'upload';

$action_ary = array(
	'upload' => 'xheditor_act_upload'
);
//执行函数
if($action && ($fun = $action_ary[$action])){
	$fun();
}

function xheditor_act_upload(){
	$immediate=isset($_GET['immediate'])?$_GET['immediate']:0;//是否立即上传模式
	$dist_dir = $_GET['dir'] ? $_GET['dir'] : 'pic';
	global $xheditor_obj;
	$row = $xheditor_obj->xheditor_upload($dist_dir);
	if($immediate > 0){
		$row['msg']['url'] = '!' . $row['msg']['url'];
	}
	echo json_encode($row);
}











?>